<?php
/**
 * delete部门
 */
apf_require_controller("HrAbstract");

class Hr_Ajax_DeleteDepartmentController extends HrAbstractController {

    public function handle_request() {
        $params = $this->request->get_parameters();
        $dep_id = intval($params['id']);
        $status = 0;
        if(empty($dep_id)){
            $this->json_encode($status,Const_Tip::ERROR_PARAM);
        }
        $dep_bll = new Bll_Hr_Department();
        $del_status = $dep_bll->delete_department($dep_id);
        //成功删除部门 删除相关部门职位
        if(!$del_status){
            $this->json_encode($status,Const_Tip::ERROR_DEPARTMENT_HAS_PEOPLE);
        }
        $status = 1;
        $this->json_encode($status,Const_Tip::OPT_SUCCESS);
    }
}